#include<stdio.h>
#include<stdlib.h>

int main()
{
	char buf[10] = {};


	FILE *fp = fopen("a.txt","r+");
	if(!fp){
		perror("fopen");
		return -1;
	}

	//移动读写位置到离文件开头10字节 
	fseek(fp,10,SEEK_SET);
	fread(buf,1,5,fp);
	printf("buf = %s\n",buf);

	bzero(buf,10);
	fseek(fp,-5,SEEK_CUR); //移动读写位置到当前位置之后5个字节
	fread(buf,1,5,fp);
	printf("buf = %s\n",buf);


	printf("%ld\n",ftell(fp));

	//移动读写位置到当前文件末尾 
	fseek(fp,0,SEEK_END);
	printf("%ld\n",ftell(fp));

	fclose(fp);
	return 0;
}